invite=["Zhang san","Li si","Wang wu"]

for name in invite:
    print("Daring "+name)
    print("    I hope that we can have a dinner tonight together and I bring the best food from my hometown.")
    print("                                                                     wish your agreement")
new_invite=[]
invite=[{"name":"Zhang san","can or not":"can"},{"name":"Li si","can or not":"not"},{"name":"Wang wu","can or not":"can"}]
for item in invite:
    if item["can or not"]=="can":
        new_invite.append(item["name"])
print(new_invite)
begging_invite="John"
middle_invite="Jenie"
end_invite="Leo"  

new_invite.insert(0,begging_invite)
l=len(new_invite)+1
if l%2==0:
    new_invite.insert(l//2,middle_invite)
if l%2==1:
    l=l-1
    new_invite.insert(l//2,middle_invite)
l1=len(new_invite)
new_invite.insert(l1,end_invite)
print(new_invite)